<template>
    <div class="not-found-container">
        <div class="not-found-card">
            <div class="not-found-header">
                <h1 class="not-found-title">404</h1>
                <p class="not-found-subtitle">战士迷失在黑暗森林中</p>
            </div>

            <div class="not-found-content">
                <div class="lost-warrior">
                    <div class="campfire"></div>
                    <div class="warrior"></div>
                    <div class="sword"></div>
                </div>
                <p class="not-found-message">你似乎偏离了正确的道路...</p>
                <div class="not-found-buttons">
                    <button class="not-found-button primary" @click="returnToMenu">
                        <el-icon>
                            <HomeFilled />
                        </el-icon>
                        <span>返回篝火</span>
                    </button>
                </div>
            </div>

            <div class="not-found-footer">
                <p class="not-found-quote">"即使在最黑暗的森林中，篝火的光芒也能指引你回家。"</p>
            </div>
        </div>
    </div>
</template>

<script setup>
    import { HomeFilled } from '@element-plus/icons-vue'
    import { useRouter } from 'vue-router'

    const router = useRouter()

    const returnToMenu = () => {
        router.push('/')
    }
</script>

<style scoped>
    .not-found-container {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        width: 100vw;
        background-color: rgba(0, 0, 0, 0.8);
    }

    .not-found-card {
        width: 500px;
        background-color: rgba(0, 0, 0, 0.7);
        border-radius: 12px;
        padding: 30px;
        box-shadow: 0 0 30px rgba(255, 150, 0, 0.3);
        border: 1px solid rgba(255, 150, 0, 0.3);
        color: #fff;
        animation: fadeIn 0.5s ease-in-out;
        transform: scale(1);
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
        height: 600px;
    }

    .not-found-card:hover {
        transform: scale(1.01);
        box-shadow: 0 0 40px rgba(255, 150, 0, 0.5);
    }

    .not-found-header {
        text-align: center;
        margin-bottom: 30px;
        padding-bottom: 20px;
        border-bottom: 1px solid rgba(255, 150, 0, 0.3);
    }

    .not-found-title {
        font-size: 5rem;
        color: white;
        margin: 0;
        text-shadow: 0 0 10px #ff6e00;
        font-family: 'consolas', monospace;
        font-style: italic;
        user-select: none;
        letter-spacing: 2px;
    }

    .not-found-subtitle {
        font-size: 1.2rem;
        color: rgba(255, 255, 255, 0.7);
        margin-top: 5px;
        animation: fadeIn 0.5s ease-in-out;
    }

    .not-found-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 30px;
    }

    .lost-warrior {
        position: relative;
        width: 200px;
        height: 200px;
    }

    .campfire {
        position: absolute;
        width: 60px;
        height: 60px;
        background: radial-gradient(circle at center, #ff6600, transparent 70%);
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 50%;
        animation: flicker 1s infinite alternate;
        z-index: 1;
    }

    .campfire::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 30px;
        background-color: #333;
        border-radius: 50%;
        z-index: -1;
    }

    .warrior {
        position: absolute;
        width: 40px;
        height: 60px;
        background-color: #555;
        bottom: 50px;
        left: 100px;
        border-radius: 10px 10px 0 0;
        z-index: 2;
    }

    .warrior::before {
        content: '';
        position: absolute;
        width: 20px;
        height: 20px;
        background-color: #777;
        border-radius: 50%;
        top: -15px;
        left: 10px;
    }

    .sword {
        position: absolute;
        width: 8px;
        height: 50px;
        background-color: #999;
        bottom: 50px;
        right: 70px;
        transform: rotate(-30deg);
        z-index: 1;
    }

    .sword::before {
        content: '';
        position: absolute;
        width: 16px;
        height: 8px;
        background-color: #ccc;
        top: -8px;
        left: -4px;
    }

    .not-found-message {
        font-size: 1.5rem;
        color: rgba(255, 255, 255, 0.9);
        text-align: center;
        text-shadow: 0 0 5px rgba(255, 105, 0, 0.7);
        animation: pulse 2s infinite;
    }

    .not-found-buttons {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .not-found-button {
        width: 80%;
        height: 60px;
        font-size: 1.2rem;
        transition: all 0.3s ease;
        padding: 0 20px;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: rgba(0, 0, 0, 0.5);
        border: none;
        border-radius: 8px;
        color: white;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }

    .not-found-button::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
        transform: translateX(-100%);
        transition: transform 0.5s;
    }

    .not-found-button:hover::before {
        transform: translateX(100%);
    }

    .not-found-button:hover {
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    }

    .not-found-button.primary {
        border: 2px solid #ff7700;
        box-shadow: 0 0 10px rgba(255, 119, 0, 0.3);
    }

    .not-found-button.primary:hover {
        box-shadow: 0 5px 15px rgba(255, 119, 0, 0.5);
    }

    .not-found-footer {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid rgba(255, 150, 0, 0.3);
        text-align: center;
    }

    .not-found-quote {
        font-style: italic;
        color: rgba(255, 255, 255, 0.6);
        font-size: 0.9rem;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes flicker {
        0% {
            box-shadow:
                0 0 10px 2px rgba(255, 150, 0, 0.8),
                0 0 20px 5px rgba(255, 100, 0, 0.5);
            opacity: 0.9;
        }
        100% {
            box-shadow:
                0 0 15px 3px rgba(255, 150, 0, 0.9),
                0 0 25px 8px rgba(255, 100, 0, 0.6);
            opacity: 1;
        }
    }

    @keyframes pulse {
        0% {
            transform: scale(1);
        }
        50% {
            transform: scale(1.02);
        }
        100% {
            transform: scale(1);
        }
    }
</style>
